package com.hspedu.newData.dmsxl.数组;
/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-13 
 * @Version: 1.0
 */

public class LC832翻转图像 {

    public int[][] flipAndInvertImage(int[][] image) {

        for (int i = 0; i < image.length; i++) {
            int left = 0;
            int right = image[0].length - 1;

            while (left < right){
                int temp = image[i][left];
                image[i][left] = image[i][right];
                image[i][right] = temp;
                left++;
                right--;
            }

            for (int j = 0; j < image[0].length; j++) {
                image[i][j] = Math.abs(image[i][j] - 1);
            }

        }

        return image;
    }
}
